/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __ZOOKEEPER_JUTE__
#define __ZOOKEEPER_JUTE__
#include "recordio.h"

#ifdef __cplusplus
extern "C" {
#endif

struct op_result_t {
    int32_t rc;
    int32_t op;
    struct buffer response;
};
int serialize_op_result_t(struct oarchive *out, const char *tag, struct op_result_t *v);
int deserialize_op_result_t(struct iarchive *in, const char *tag, struct op_result_t*v);
void deallocate_op_result_t(struct op_result_t*);
struct ConnectRequest {
    int64_t lastZxidSeen;
    int32_t timeOut;
    int64_t sessionId;
};
int serialize_ConnectRequest(struct oarchive *out, const char *tag, struct ConnectRequest *v);
int deserialize_ConnectRequest(struct iarchive *in, const char *tag, struct ConnectRequest*v);
void deallocate_ConnectRequest(struct ConnectRequest*);
struct ConnectResponse {
    int32_t timeOut;
    int64_t sessionId;
    int32_t cxid;
};
int serialize_ConnectResponse(struct oarchive *out, const char *tag, struct ConnectResponse *v);
int deserialize_ConnectResponse(struct iarchive *in, const char *tag, struct ConnectResponse*v);
void deallocate_ConnectResponse(struct ConnectResponse*);
struct RequestHeader {
    int32_t xid;
    int32_t nonce;
    int32_t type;
};
int serialize_RequestHeader(struct oarchive *out, const char *tag, struct RequestHeader *v);
int deserialize_RequestHeader(struct iarchive *in, const char *tag, struct RequestHeader*v);
void deallocate_RequestHeader(struct RequestHeader*);
struct ReplyHeader {
    int32_t xid;
    int32_t nonce;
    int32_t type;
    int64_t zxid;
    int32_t err;
};
int serialize_ReplyHeader(struct oarchive *out, const char *tag, struct ReplyHeader *v);
int deserialize_ReplyHeader(struct iarchive *in, const char *tag, struct ReplyHeader*v);
void deallocate_ReplyHeader(struct ReplyHeader*);
struct GetDataRequest {
    int64_t blockId;
};
int serialize_GetDataRequest(struct oarchive *out, const char *tag, struct GetDataRequest *v);
int deserialize_GetDataRequest(struct iarchive *in, const char *tag, struct GetDataRequest*v);
void deallocate_GetDataRequest(struct GetDataRequest*);
struct BoloskyGetDataRequest {
    int64_t blockId;
    int32_t serverId;
};
int serialize_BoloskyGetDataRequest(struct oarchive *out, const char *tag, struct BoloskyGetDataRequest *v);
int deserialize_BoloskyGetDataRequest(struct iarchive *in, const char *tag, struct BoloskyGetDataRequest*v);
void deallocate_BoloskyGetDataRequest(struct BoloskyGetDataRequest*);
struct SetDataRequest {
    int64_t blockId;
    struct buffer data;
};
int serialize_SetDataRequest(struct oarchive *out, const char *tag, struct SetDataRequest *v);
int deserialize_SetDataRequest(struct iarchive *in, const char *tag, struct SetDataRequest*v);
void deallocate_SetDataRequest(struct SetDataRequest*);
struct PrepareDataRequest {
    int64_t clientId;
    int32_t count;
    struct buffer data;
};
int serialize_PrepareDataRequest(struct oarchive *out, const char *tag, struct PrepareDataRequest *v);
int deserialize_PrepareDataRequest(struct iarchive *in, const char *tag, struct PrepareDataRequest*v);
void deallocate_PrepareDataRequest(struct PrepareDataRequest*);
struct SyncRequest {
    int64_t blockId;
};
int serialize_SyncRequest(struct oarchive *out, const char *tag, struct SyncRequest *v);
int deserialize_SyncRequest(struct iarchive *in, const char *tag, struct SyncRequest*v);
void deallocate_SyncRequest(struct SyncRequest*);
struct SyncResponse {
    int64_t blockId;
};
int serialize_SyncResponse(struct oarchive *out, const char *tag, struct SyncResponse *v);
int deserialize_SyncResponse(struct iarchive *in, const char *tag, struct SyncResponse*v);
void deallocate_SyncResponse(struct SyncResponse*);
struct GetDataResponse {
    struct buffer data;
};
int serialize_GetDataResponse(struct oarchive *out, const char *tag, struct GetDataResponse *v);
int deserialize_GetDataResponse(struct iarchive *in, const char *tag, struct GetDataResponse*v);
void deallocate_GetDataResponse(struct GetDataResponse*);
struct BoloskyGetDataResponse {
    struct buffer data;
};
int serialize_BoloskyGetDataResponse(struct oarchive *out, const char *tag, struct BoloskyGetDataResponse *v);
int deserialize_BoloskyGetDataResponse(struct iarchive *in, const char *tag, struct BoloskyGetDataResponse*v);
void deallocate_BoloskyGetDataResponse(struct BoloskyGetDataResponse*);
struct QuorumPacket {
    int32_t type;
    int64_t zxid;
    struct buffer data;
};
int serialize_QuorumPacket(struct oarchive *out, const char *tag, struct QuorumPacket *v);
int deserialize_QuorumPacket(struct iarchive *in, const char *tag, struct QuorumPacket*v);
void deallocate_QuorumPacket(struct QuorumPacket*);
struct FileHeader {
    int32_t magic;
    int32_t version;
    int64_t dbid;
};
int serialize_FileHeader(struct oarchive *out, const char *tag, struct FileHeader *v);
int deserialize_FileHeader(struct iarchive *in, const char *tag, struct FileHeader*v);
void deallocate_FileHeader(struct FileHeader*);
struct TxnHeader {
    int64_t clientId;
    int32_t cxid;
    int32_t nonce;
    int64_t zxid;
    int64_t time;
    int32_t type;
};
int serialize_TxnHeader(struct oarchive *out, const char *tag, struct TxnHeader *v);
int deserialize_TxnHeader(struct iarchive *in, const char *tag, struct TxnHeader*v);
void deallocate_TxnHeader(struct TxnHeader*);
struct SetDataTxn {
    int64_t sessionId;
    int64_t blockId;
    struct buffer data;
};
int serialize_SetDataTxn(struct oarchive *out, const char *tag, struct SetDataTxn *v);
int deserialize_SetDataTxn(struct iarchive *in, const char *tag, struct SetDataTxn*v);
void deallocate_SetDataTxn(struct SetDataTxn*);
struct PrepareDataTxn {
    int64_t sessionId;
    int32_t xid;
    struct buffer data;
};
int serialize_PrepareDataTxn(struct oarchive *out, const char *tag, struct PrepareDataTxn *v);
int deserialize_PrepareDataTxn(struct iarchive *in, const char *tag, struct PrepareDataTxn*v);
void deallocate_PrepareDataTxn(struct PrepareDataTxn*);
struct ErrorTxn {
    int32_t err;
};
int serialize_ErrorTxn(struct oarchive *out, const char *tag, struct ErrorTxn *v);
int deserialize_ErrorTxn(struct iarchive *in, const char *tag, struct ErrorTxn*v);
void deallocate_ErrorTxn(struct ErrorTxn*);

#ifdef __cplusplus
}
#endif

#endif //ZOOKEEPER_JUTE__
